﻿@if (Request.IsAuthenticated)
{
    <text>
        @*@Html.ActionLink("Đăng Ký Công Ty", "RegisterAgency", "Account", routeValues: null, htmlAttributes:
                new Dictionary<string, object> { { "class", "btn" }, { "data-toggle", "modal" }, { "title", "Quản Lý Công Ty" } })
            @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes:
                new Dictionary<string, object> { { "class", "btn" }, { "data-toggle", "modal" }, { "title", "Quản Lý" } })
            @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", style = "display:inline;" }))
            {
                <a href="javascript:document.getElementById('logoutForm').submit()" title="Open Modal window" data-toggle="modal" class="btn">Đăng Xuất</a>
                @Html.AntiForgeryToken()
            }
        *@

        @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", style = "display:inline;" }))
        {
            <button type="submit" class="login-modal">
                <i class="fa-sign-in mi"></i>Đăng Xuất
            </button>
            @Html.AntiForgeryToken()
        }
        <a href="@Url.Action("Manage", "Account", routeValues: null)" title="Quản Lý" data-toggle="modal" class="login-modal">
            <i class="fa-edit mi"></i>@User.Identity.Name
        </a>
        @if (User.IsInRole("Administrator"))
        {
            <a href="@Url.Action("Dashboard", "Admin", new { Area = "Management" })" title="Quản Lý" data-toggle="modal" class="login-modal">
                <i class="fa-briefcase mi"></i>Trang Admin
            </a>
        }
        else
        {
             if (User.IsInRole("Agency"))
             {
                 <a href="@Url.Action("ManageAgency", "Account")" title="Quản Lý" data-toggle="modal" class="login-modal">
                     <i class="fa-briefcase mi"></i>Quản Lý Công Ty Của Bạn
                 </a>
             }
             else
             {
                 <a href="@Url.Action("RegisterAgency", "Account", routeValues: null)" title="Quản Lý" data-toggle="modal" class="login-modal">
                    <i class="fa-briefcase mi"></i>Đăng Ký Công Ty
                </a>
             }
        }
    </text>
}
else
{
    @*@Html.ActionLink("Đăng Ký Công Ty", "RegisterAgency", "Account", routeValues: null, htmlAttributes:
        new Dictionary<string, object> { { "class", "login-modal" }, { "data-toggle", "modal" }, { "title", "Quản Lý" } })*@
    <button class="login-modal" data-toggle="modal" data-target="#loginModal">
        <i class="fa-sign-in mi"></i>Đăng Nhập
    </button>
    <a href="@Url.Action("Register", "Account", routeValues: null)" id="registerLink" title="Open Modal window" data-toggle="modal" class="login-modal">
        <i class="icon icon icon-user-add mi"></i>Đăng Ký
    </a>
    <a href="@Url.Action("RegisterAgency", "Account", routeValues: null)" title="Quản Lý" data-toggle="modal" class="login-modal">
        <i class="fa-briefcase mi"></i>Đăng Ký Công Ty
    </a>

    @*@Html.ActionLink("Đăng Ký", "Register", "Account", routeValues: null, htmlAttributes:
        new Dictionary<string, object> { { "id", "registerLink" }, { "class", "btn" }, { "data-toggle", "modal" }, { "title", "Open Modal window" } })*@
    @*<a href="#login" title="Open Modal window" data-toggle="modal" class="btn">Đăng Nhập</a>*@
}

@*<div aria-hidden="true" aria-labelledby="login" role="dialog" tabindex="-1" class="modal fade" id="login" style="display: none;">*@
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <!-- MODAL STARTS -->
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-header">
                <!-- modal header -->
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button"><i class="icon-remove"></i></button>
                <h4 class="modal-title"><i class="icon-signin"></i>Đăng Nhập</h4>
            </div>

            <div class="modal-body">
                <!-- modal body -->
                @model  VietTrips.WebUI.Models.LoginModel
                @using (Html.BeginForm("Login", "Account", FormMethod.Post,
                    htmlAttributes: new Dictionary<string, object> { { "role", "form" } }))
                {
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)

                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa-user"></i></span>
                            @Html.TextBoxFor(m => m.UserName,
                            htmlAttributes: new Dictionary<string, object> { { "class", "form-control" }, { "placeholder", "Tên Đăng Nhập" } })
                            @Html.ValidationMessageFor(m => m.UserName)
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon"><i class="fa-lock"></i></span>
                            @Html.PasswordFor(m => m.Password,
                            htmlAttributes: new Dictionary<string, object> { { "class", "form-control" }, { "placeholder", "Mật Khẩu" } })
                            @Html.ValidationMessageFor(m => m.Password)
                        </div>
                    </div>
                    
                    <div class="checkbox">
                        <label>
                            @Html.CheckBoxFor(m => m.RememberMe, htmlAttributes: new { id = "remember-me", @style = "margin-top: 8px;" })
                            Lưu thông tin đăng nhập
                        </label>
                    </div>
                    <button type="submit" class="btn btn-lg btn-primary btn-block">Đăng Nhập</button>
                }
                <div class="or text-center">hoặc</div>
                
                @Html.ActionLink("Đăng Ký", "Register", "Account", routeValues: null, htmlAttributes:
                    new Dictionary<string, object> { { "class", "btn btn-lg btn-warning btn-block" } })
                <div class="or text-center">
                    <a href="#" class="or" style="font-size: 13px; color: #5656b2;">Quên mật khẩu?</a>
                </div>
        </div>
    </div>
</div>

@*
    <button class="login-modal" data-toggle="modal" data-target="#loginModal">
        <i class="fa-sign-in mi"></i>Đăng Nhập
    </button>
    <button class="login-modal" data-toggle="modal" data-target="#registerModal">
        <i class="icon icon icon-user-add mi"></i>Đăng Ký
    </button>
    <button class="login-modal" data-toggle="modal" data-target="#loginModal">
        <i class="fa-sign-in mi"></i>Đăng Ký Công Ty Du Lịch
    </button>*@

@*<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Login</h4>
                </div>
                <div class="modal-body">
                    <form role="form">
                        <div class="form-group">
                            <label for="show-login">Email / Username</label>
                            <input type="text" class="form-control" id="show-login" placeholder="Email / Username" />
                        </div>
                        <div class="form-group">
                            <label for="show-password">Password</label>
                            <input type="password" class="form-control" id="show-password" placeholder="Password" />
                        </div>
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" /> Remember Me
                            </label>
                        </div>
                        <a href="#" class="forgot" style="color: #3C454E;">Forgot Your Password?</a>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">Login</button>
                    <button type="button" class="btn btn-warning" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>*@